﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Com.Framework;
using Com.Framework.Data;
namespace Com.Library.DB.Advertise
{
	public class AdvertiseModel
	{
		public static void Create(AdvertiseCreateArguments arg)
		{
			AdvertiseCreate sp = new AdvertiseCreate();
			sp.SetArguments(arg);
			sp.ExecuteNonQuery();
		}

		public static void Modify(AdvertiseModifyArguments arg)
		{
			AdvertiseModify sp = new AdvertiseModify();
			sp.SetArguments(arg);
			sp.ExecuteNonQuery();
		}

		public static AdvertiseEntity GetInfo(int AdvertiseNo)
		{
			AdvertiseGetInfoArguments arg = new AdvertiseGetInfoArguments();
			arg.n4AdvertiseNo = AdvertiseNo;

			AdvertiseGetInfo sp = new AdvertiseGetInfo();
			sp.SetArguments(arg);
			AdvertiseEntity info = sp.ExecuteNonQuery();
			return info;
		}

		public static void Remove(int AdvertiseNo)
		{
			AdvertiseRemoveArguments arg = new AdvertiseRemoveArguments();
			arg.n4AdvertiseNo = AdvertiseNo;

			AdvertiseRemove sp = new AdvertiseRemove();
			sp.SetArguments(arg);
			sp.ExecuteNonQuery();
		}

		public static ListData<AdvertiseEntity, OutputEntity> GetList(int CategoryNo, int PageNo, byte PageSize)
		{
			AdvertiseGetListArguments arg = new AdvertiseGetListArguments();
			arg.PageNo = PageNo;
			arg.PageSize = PageSize;
			arg.n4CategoryNo = CategoryNo;

			AdvertiseGetList sp = new AdvertiseGetList();
			sp.SetArguments(arg);
			List<AdvertiseEntity> list = sp.Execute();
			OutputEntity output = sp.GetOutput();

			return new ListData<AdvertiseEntity, OutputEntity>(list, output);
		}

		public static void GetMoveNo(int AdvertiseNo, out int AdvertiseNo_Prev, out int Advertise_Next)
		{
			AdvertiseGetInfoMoveNoArguments arg = new AdvertiseGetInfoMoveNoArguments();
			arg.n4AdvertiseNo = AdvertiseNo;
			AdvertiseGetInfoMoveNo sp = new AdvertiseGetInfoMoveNo();
			sp.SetArguments(arg);
			DataEntity info = sp.ExecuteNonQuery();
			AdvertiseNo_Prev = info.GetData2("n4AdvertiseNo_Prev", 0);
			Advertise_Next = info.GetData2("n4AdvertiseNo_Next", 0);
		}
	}
}
